package com.woniu113.junk.order.client;

import com.woniu113.junk.commons.model.Result;
import com.woniu113.junk.order.client.dto.GoodsDTO;
import com.woniu113.junk.order.client.dto.StationInfo;
import com.woniu113.junk.order.client.dto.StationInfoDTO;
import com.woniu113.junk.order.client.dto.WasteTypeDTO;
import com.woniu113.junk.order.feign.FeignConfig;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(name = "junk-site",configuration = FeignConfig.class ,path = "/site")
public interface SiteClient {
    /**
     * 根据商品id查询商品信息
     * @param goodsId:商品id
     * @return 返回查询出的商品数据、成功提示和code
     */
    @GetMapping("/goodsInfo/findByGoodsId")
    public Result<GoodsDTO> findByGoodsId(@RequestParam("goodsId") Integer goodsId);
    /**
     * 根据商品ID修改商品库存(用于用户积分兑换时)
     * @param goodsId:商品id
     * @param reduceNumber:减少的库存量
     * @return 返回成功提示和code
     */
    @GetMapping("/goodsInfo/updateNumberByGoodsId")
    public Result updateNumberByGoodsId(@RequestParam("goodsId") Integer goodsId,@RequestParam("reduceNumber") Integer reduceNumber);
    /**
     * 根据站点id查询站点信息
     * @param stationId:站点id
     * @return 返回查询到的站点信息,成功提示和code
     */
    @GetMapping("/stationInfo/findStationInfoById")
    public Result<StationInfoDTO> findStationInfoById(@RequestParam("stationId") Integer stationId);
    /**
     * 按照废品类型id查询废品类型
     * @param typeId 废品类型id
     * @return 返回查询数据,成功提示与成功code
     */
    @GetMapping("wasteType/findByTypeId")
    public Result<WasteTypeDTO> findByTypeId(@RequestParam("typeId") Integer typeId);
    /**
     * 根据子站点id查询区站点信息
     * @param stationId 子站点id
     * @return 返回查询到的站点信息,成功提示和code
     */
    @GetMapping("/stationInfo/findFatherStationById")
    public Result<StationInfoDTO> findFatherStationById(@RequestParam("stationId") Integer stationId);
    /**
     * 根据(城市/区县)查询站点类型为子站点的站点信息(下单用)
     */
    @GetMapping("/stationInfo/findChildStationByCityAndCounty")
    public Result<List<StationInfoDTO>> findChildStationByCityAndCounty(@RequestParam("city") String city, @RequestParam("county") String county);


    /**
     * 根据当前登录用户查询当前用户的站点
     */
    @GetMapping("/stationInfo/findStationByAdminId2")
    @ApiOperation(value = "根据当前登录用户查询当前用户的站点")
    public Result<StationInfo> findStationByAdminId2(@RequestParam("adminId") Integer adminId);
}
